Conversation
WalkthroughcreateCommitAndWelcomes の呼び出し前に、保存済みMLSグループ状態を reviveGroupState で再構築する処理を追加。Chat.tsx と ChatSettingsOverlay.tsx に適用。reviveGroupState を e2ee/storage.ts に実装・公開。ChatSettingsOverlay の一般タブで軽微なUIレイアウト調整。 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as User
participant Chat as Chat/Settings UI
participant Store as e2ee/storage.reviveGroupState
participant MLS as createCommitAndWelcomes
User->>Chat: メンバー変更/設定更新操作
Chat->>Store: reviveGroupState(storedGroup)
Store-->>Chat: revivedGroup
Chat->>MLS: createCommitAndWelcomes(revivedGroup, ...)
MLS-->>Chat: commit, welcomes
Chat-->>User: 完了/反映
note over Store,MLS: 復元を必須化し、非JSON要素を再構築
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/client/src/components/e2ee/storage.ts (1)
142-145: reviveGroupState の追加は目的に合致(TypedArrayの復元)—ただし安全性と将来拡張に向けて微調整を提案
- 直前で serialize → deserialize の往復を行う実装は、JSON 化で壊れた TypedArray を最小変更で復元でき、createCommitAndWelcomes 直前の AES-GCM エラー回避という目的に合っています。
- 併せて、deserialize 側の reviver が globalThis から動的にコンストラクタを引いて new する実装は柔軟ですが、将来的な安全性/保守性の観点では許容 $type のホワイトリスト化を推奨します(例えば TypedArray 系 + Date/Map など、想定する最小集合に限定)。また未知の $type は素通し/警告で握りつぶすと事故りにくいです。
- パフォーマンス面では JSON 往復がオーバーヘッドになる可能性がありますが、呼び出し箇所が限定的(Commit/Welcome 生成前のみ)であれば実害は小さいと見ています。
以下の2点、意図を確認させてください。
- reviveGroupState 経由だと clientConfig が defaultClientConfig に置き換わります(Line 108, 139 近辺の処理)。ランタイムで clientConfig を差し替えるユースケースはありませんか?
- $type の許容値を TypedArray 系のみに限定してよい前提でしょうか?
ホワイトリスト化の骨子(参考・抜粋、既存関数内の修正案):
// 許可する型のみを明示 const ALLOWED_CTORS = new Map<string, new (data: unknown) => unknown>([ ["Uint8Array", Uint8Array], ["Uint16Array", Uint16Array], ["Uint32Array", Uint32Array], ["Int8Array", Int8Array], ["Int16Array", Int16Array], ["Int32Array", Int32Array], ["Float32Array", Float32Array], ["Float64Array", Float64Array], ["BigInt64Array", BigInt64Array], ["BigUint64Array", BigUint64Array], ]); // reviver の default 節: const ctor = ALLOWED_CTORS.get(v.$type); if (ctor) return new ctor(v.data as unknown); // 未知の $type はそのまま返す or ログ return value;app/client/src/components/chat/ChatSettingsOverlay.tsx (1)
588-644: 一般タブのUI微調整(a11y/小さな可読性改善の提案)
- Line 591/595: label と input が別要素なので関連付け(for/id)の追加を推奨。
- Line 617-629: file input は class="hidden" と inline style={{ display: "none" }} が重複。style は不要です。アップロード中は疑似ボタン(label)に pointer-events を無効化して二重送信を防ぐとより扱いやすいです。
以下の差分で軽量に改善できます(該当範囲内のみ変更):
- <label class="block text-sm text-gray-400 mb-1"> + <label for="roomName" class="block text-sm text-gray-400 mb-1"> ルーム名 </label> - <input + <input id="roomName" value={roomName()} onInput={(e) => setRoomName(e.currentTarget.value)} class="w-full bg-[#2b2b2b] border border-[#3a3a3a] rounded px-3 py-2 text-white focus:outline-none focus:border-blue-500" placeholder="ルーム名" /> ... - <label class="px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded cursor-pointer text-sm"> + <label + class={`px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded cursor-pointer text-sm ${uploading() ? "opacity-60 pointer-events-none" : ""}`} + aria-disabled={uploading()} + > <input type="file" accept="image/*" class="hidden" - style={{ display: "none" }} onChange={(e) => { const f = e.currentTarget.files?.[0]; if (f) handleIconChange(f); }} /> {uploading() ? "アップロード中..." : "画像を選択"} </label>
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
app/client/src/components/Chat.tsx(3 hunks)app/client/src/components/chat/ChatSettingsOverlay.tsx(3 hunks)app/client/src/components/e2ee/storage.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: TypeScriptの型定義を活用する
エラーハンドリングを適切に実装する
Files:
app/client/src/components/e2ee/storage.tsapp/client/src/components/Chat.tsxapp/client/src/components/chat/ChatSettingsOverlay.tsx
🧬 Code graph analysis (3)
app/client/src/components/e2ee/storage.ts (1)
app/client/src/components/e2ee/mls_wrapper.ts (1)
StoredGroupState(40-40)
app/client/src/components/Chat.tsx (1)
app/client/src/components/e2ee/storage.ts (1)
reviveGroupState(143-145)
app/client/src/components/chat/ChatSettingsOverlay.tsx (1)
app/client/src/components/e2ee/storage.ts (1)
reviveGroupState(143-145)
🔇 Additional comments (4)
app/client/src/components/Chat.tsx (2)
63-64: reviveGroupState の import 追加は妥当ですcreateCommitAndWelcomes 前の復元フローと整合しています。
1539-1543: 全てのアプリケーションコード呼び出しで reviveGroupState を適用済み
- 下記ファイルにある createCommitAndWelcomes 呼び出しはすべて reviveGroupState を第一引数に渡しています
- app/client/src/components/chat/ChatSettingsOverlay.tsx (行 412)
- app/client/src/components/Chat.tsx (行 1539, 1741)
- テストコード(app/client/src/components/e2ee/mls_test.ts)の呼び出しは意図的に異なる引数を渡しているため、本件検証の対象外としています
将来的に「呼び忘れ」を防止するには、mls_wrapper.ts 側で内部的に revive を自動実行するラッパー設計を検討すると良いでしょう。
app/client/src/components/chat/ChatSettingsOverlay.tsx (2)
11-13: reviveGroupState の import 追加は妥当です後段の createCommitAndWelcomes での利用と一致しています。
412-415: メンバー追加の Commit/Welcome 生成前に revive を適用している点は適切です永続状態や props 経由の state に含まれる TypedArray の欠落を確実に補正できます。
概要
reviveGroupStateを追加テスト
deno fmt app/client/src/components/Chat.tsx app/client/src/components/e2ee/storage.ts app/client/src/components/chat/ChatSettingsOverlay.tsxdeno lint app/client/src/components/Chat.tsx app/client/src/components/e2ee/storage.ts app/client/src/components/chat/ChatSettingsOverlay.tsxhttps://chatgpt.com/codex/tasks/task_e_68a873c3ff348328b06cd9a9e06ae9bc
Summary by CodeRabbit